﻿using CallNumberSystem;

using GeuSoftWare.com;

using GeusoftWareDigitalCertificate;

using NxStoreManage;

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace LengthAiCalculate
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SetControlPanelIcon.SetAddRemoveProgramsIcon("main");
            DigitalCertificate.Create(new List<System.Security.Cryptography.X509Certificates.StoreName>()
            {
                System.Security.Cryptography.X509Certificates.StoreName.TrustedPeople,
                System.Security.Cryptography.X509Certificates.StoreName.TrustedPublisher
            });
            WriteLogHelper.InitDefaultLogDir();
            if (string.IsNullOrEmpty(Properties.Settings.Default.DbConn) || string.IsNullOrEmpty(Properties.Settings.Default.SbDbConn))
            {
                int tabs = -1;
                if (string.IsNullOrEmpty(Properties.Settings.Default.DbConn) && string.IsNullOrEmpty(Properties.Settings.Default.SbDbConn))
                {
                    tabs = 2;
                }
                else if (string.IsNullOrEmpty(Properties.Settings.Default.DbConn) && !string.IsNullOrEmpty(Properties.Settings.Default.SbDbConn))
                {
                    tabs = 0;
                }
                else if (!string.IsNullOrEmpty(Properties.Settings.Default.DbConn) && string.IsNullOrEmpty(Properties.Settings.Default.SbDbConn))
                {
                    tabs = 1;
                }
                SetDataConn setDataConn = new SetDataConn
                {
                    TabVisible = tabs
                };
                BaseForm.SetShowFormDefault(setDataConn);
                Application.Run(setDataConn);
            }
            else
            {
                Form startFrm = new Login();
                BaseForm.SetShowFormDefault(startFrm);
                startFrm.MinimizeBox = true;
                Application.Run(startFrm);
            }
        }
    }
}